<template>
    <div class="message-item" @click="handleNaviMessage">
        <div class="title">{{item.title}}</div>
        <div class="desc">{{item.content}}</div>
        <div class="time">{{item.createTime}}</div>
    </div>
</template>
<script>
    import https from "../https";
    import { updateMessage } from "../constants/api"
    export default {
        components: {
        },
        props: {
            item: {
                type: Object
            },
            id: {
                type: String
            }
        },
        data() {
            return {

            }
        },
        mounted() {
        },
        methods: {
            handleNaviMessage() {
                if (this.id == this.item.id) {
                    this.updateTime()
                }

                this.$router.push(`/message-detail?id=${this.item.id}`)
            },
            async updateTime() {
                const json = await https.fetchGet(updateMessage, {})
            }
        }
    };
</script>
<style lang="less">
    .message-item {
        width:6.40rem;
        background:rgba(255,255,255,1);
        box-shadow:0px 0.05rem .17rem 0.01rem rgba(173,173,173,0.21);
        border-radius: .10rem;
        padding: .43rem .25rem 0 .25rem;
        .title {
            font-weight:bold;
            color:rgba(51,51,51,1);
            margin-bottom: .30rem;
            text-align: center;
        }
        .desc {
            padding-bottom: .40rem;
            border-bottom: .01rem dashed #cbcbcb;
        }

        .time {
            padding: .29rem 0;
            font-size: .24rem;
            color: #999;
            text-align: right;
        }
    }
</style>

